<!doctype html>
<html>

<head>
	<meta charset="UTF-8">
	<title>轴承CMS</title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<link href="__WX__/mui/css/mui.min.css" rel="stylesheet" />
	<link href="__WX__/css/iconfont.css" rel="stylesheet" />
</head>
<script src="__WX__/js/jquery.min.js"></script>
<style>
	ul li{
		list-style: none;
		padding:0;
		margin:0;
		border:0;
	}
	.xuan{
		border-radius: 15px;
		margin-right:10px;
	}
	.tijiao{
		width:330px;height:40px;text-align: center;line-height:42px;color:#fff;border-radius: 16px;margin:45px auto;
		background: -moz-linear-gradient(top, #524ABA 0%, #c6b1fc 100%);
		background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#524ABA), color-stop(100%,#c6b1fc));
		background: -webkit-linear-gradient(top, #524ABA 0%,#c6b1fc 100%);
		background: -o-linear-gradient(top, #524ABA 0%,#c6b1fc 100%);
		background: -ms-linear-gradient(top, #524ABA 0%,#c6b1fc 100%);
		background: linear-gradient(to bottom, #524ABA 0%,#c6b1fc 100%);
	}
</style>
<body style="margin:0px;background-color:#fff;">
<div class="mui-content" style="background-color:#fff;">
	<header class="mui-bar mui-bar-nav">
	<a class="mui-icon mui-icon-left-nav mui-pull-left" style="color:#53caff" href="javascript:history.back(-1)"></a>
	<a class="mui-icon mui-icon-reply mui-pull-right"></a>
	<h1 class="mui-title">{$tablename}申请</h1>
	</header>
	<form id="applying">
		{if condition="isset($name_manages) &&  !empty($name_manages)"}
		<div  style="width:90%;height:45px;margin-left:5%;margin-top:15px;margin-top: 60px;">
			<input type="hidden" name="pid" value="{$pid}">
			<h4 style="margin-left:5px;">商户列表</h4>
			<input type="hidden" name="classify_id" class="classify_id">
			<div>
				<input type="text"  class="mui-input-clear s_name" disabled="disabled" style="width:60%;float:left" placeholder="请输入商户列表">
				<button type="button" data-loading-icon-position="right" class="mui-btn xuanze" style="width:40%;height:40px;border:0px;border-left:1px solid #ccc;background-color:#53caff;color:#fff">请选择</button>
			</div>
		</div>
		<div  style="width:90%;height:45px;margin-left:5%;margin-top: 36px;">
			{volist name="name_manages" id="v"}
			<h4 style="margin-left:5px;">{$v.text}</h4>
			<input type="text" name="{$v.name}" class="mui-input-clear" placeholder="请输入{$v.text}" style="float:left;">
			{/volist}
			{if condition="$manage.is_on == 1"}
			<P style="margin:-20px 18px;"><span style="color:red;font-size:12px;line-height: 19px;">★</span>&nbsp;此申请通需要押金{$manage.money}元</P>
			{/if}
			<div class="tijiao" style="margin-top: 20%;">立即申请</div>
		</div>
		<!--城市  start-->
		<div id="popover" class="mui-popover" style="position:fixed;top:150px;left:50px;padding-top:10px;">
			{volist name="register" id="v"}
			<div class="mui-input-row mui-radio" >
				<label class="s_name" sid="{$v.id}">{$v.sh_name}</label>
				<input name="radio1" type="radio" value="{$v.id}" class="dan">
			</div>
			{/volist}
			<div class="ok" style="width:100%;height:40px;text-align: center;line-height:40px;border-top:1px solid #ccc;color:#ff5722">确定</div>
		</div>
		{/if}
		<!--<div style="margin-top: 100px;width: 900px;border-bottom: 1px solid #000000;border-color: #00b7ee;border-width: 10px;"> </div>-->
		<!--城市  end-->
	</form>
</div>
<script src="__WX__/mui/js/mui.min.js"></script>
<script>
    mui.init();
    mui('nav').on('tap','a',function(){
        window.top.location.href = this.href;
    });
</script>
</body>

<script>
    $(".xuan").click(function(){
        $(".xuan").removeClass("mui-btn-primary");
        $(this).addClass("mui-btn-primary");
    })
</script>

<script>
    var flag = true;
    function checkForm() {
        $("#applying input[type='text']").each(function(i, obj) {
            if(obj.value == "") {
                mui.alert($(obj).attr("placeholder"));
                flag = false;
                return false;
            }else{
                flag = true;
			}
        });
        return flag;
    }
</script>

<script>
    $(".tijiao").click(function(){
        var flag = checkForm();
        if(flag) {
            mui.confirm('确认申请？', null, function(event) {
                var index = event.index;
                if (index === 1) {
                    $.ajax({
                        url:'applying',
                        type:"post",
                        data:$('#applying').serialize(),
                        success:function(res){
                            if(res == 200){
                                mui.alert('申请成功');
                                setTimeout(function(){ window.location.reload();}, 1500);
                            }else{
                                mui.alert(res.msg);
                            }
                        }
                    });
                }
            });
        }
    })
</script>
<script type="text/javascript">
    mui.init();
    var gallery = mui('.mui-slider');
    gallery.slider({
        interval:2000//自动轮播周期，若为0则不自动播放，默认为0；
    });

    //监听单选框的值
    function getVals(){
        var res = getRadioRes('rds');
        if(res == null){mui.toast('请选择'); return;}
        return res;
        //mui.toast(res);
    }
    function getRadioRes(className){
        var rdsObj = document.getElementsByClassName("dan");
        var checkVal = null;
        for(i = 0; i < rdsObj.length; i++){
            if(rdsObj[i].checked){checkVal = rdsObj[i].value;}
        }
        return checkVal;
    }
    $(".xuanze").click(function(){
        mui('.mui-popover').popover('show');
    })
    $(".ok").click(function(){
        var val=getVals();//获取单选框值
        var s_name=$(".s_name[sid="+val+"]").html();
        $(".s_name").val(s_name);
        $(".classify_id").val(val);
        //Ajax发送数据后，执行下一句代码，关闭弹出层
        mui('.mui-popover').popover('hide');
    })
</script>
</html>